home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2002 January / maximum-cd-2002-01.iso / Files / Mechwarrior 4 Mapping / MW4Editor.exe / content / ABLScripts / Bots / SniperBot.abl < prev    next >
Encoding:
Text File  |  2001-07-16  |  2.7 KB  |  108 lines

  1.  
  2. fsm SniperBot : integer;
  3.  
  4.  
  5. //------------------------------------------------------------------
  6.  
  7. // SniperBot:
  8. //   Very good aim, but not very good at maneuvering.
  9.  
  10. //------------------------------------------------------------------
  11.  
  12.  
  13. //------------------------------------------------------------------
  14. //     Constants
  15. //------------------------------------------------------------------
  16.  
  17.     const
  18.         #include_ <content\ABLScripts\mwconst.abi>
  19.  
  20. //------------------------------------------------------------------
  21. //     Types
  22. //------------------------------------------------------------------
  23.  
  24.     type
  25.         #include_ <content\ABLScripts\mwtype.abi>
  26.     
  27.  
  28. //------------------------------------------------------------------
  29. //     Variables
  30. //------------------------------------------------------------------
  31.  
  32.     var
  33.         static integer            attackRange;        // At what range do I start shooting?
  34.         static integer            withdrawRange;        // At what range do I withdraw?
  35.  
  36. //------------------------------------------------------------------
  37. //     Init: my initialization function
  38. //------------------------------------------------------------------
  39.  
  40. function Init;
  41.     code
  42.         // script-specific variables
  43.         attackRange        = 9999;
  44.         withdrawRange    = 9999;
  45.  
  46.         // driver settings
  47.         SetFiringDelay            (ME,0.0,2.5);
  48.         SetIgnoreFriendlyFire    (ME,true);
  49.         SetIsShotRadius            (ME,160);
  50.         SetEntropyMood            (ME,NEUTRAL_START);
  51.         SetCurMood                (ME,NEUTRAL_START);
  52.         SetSkillLevel            (ME,75,110,60);
  53.         SetAttackThrottle        (ME,60);
  54.  
  55. endfunction;
  56.  
  57. //------------------------------------------------------------------
  58. //    StartState: my initial state
  59. //------------------------------------------------------------------
  60.  
  61. state StartState;
  62.  
  63.     code
  64.         trans WaitToAmbushState;
  65.  
  66. endstate;
  67.  
  68. //------------------------------------------------------------------
  69. //    WaitInAmbushState: wait for someone to come close enough to attack
  70. //------------------------------------------------------------------
  71.  
  72. state WaitToAmbushState;
  73.     code
  74.         if (Bot_FindEnemy(attackrange)) then
  75.             trans AttackState;
  76.         endif;
  77.  
  78.         OrderMoveLookOut;
  79. endstate;
  80.  
  81. //------------------------------------------------------------------
  82. //    AttackState: the ambush is over -- let's kick some ass!
  83. //------------------------------------------------------------------
  84.  
  85. state AttackState;
  86.     code
  87.         if (LeaveAttackState(withdrawRange)) then
  88.             trans WaitToAmbushState;
  89.         endif;
  90.  
  91.         OrderAttackTactic(TACTIC_LOCAL_PATROL,TRUE);
  92.  
  93. endstate;
  94.  
  95. //------------------------------------------------------------------
  96. //    DeadState: OK, I kicked the bucket.
  97. //------------------------------------------------------------------
  98.  
  99. state DeadState;
  100.     code
  101.         orderDie;
  102.  
  103. endstate;
  104.  
  105.  
  106. endfsm.
  107.  
  108.